package com.sdry.product.prehangingline.service;
import java.util.HashMap;
import	java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.sdry.basic.entity.Material;
import com.sdry.basic.entity.ProductionStation;
import com.sdry.product.prehangingline.entity.PreHangingLine;
import com.sdry.product.prehangingline.entity.StationMateriel;
import com.sdry.product.prehangingline.mapper.PreHangingLineMapper;
import com.sdry.product.prod.entity.ResultAppList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @program: info_sdry
 * @description: 预挂线
 * @author: cb
 * @create: 2020-03-02 14:37
 **/
@Transactional(rollbackFor = Exception.class)
@Service
public class PreHangingLineServiceImpl extends ServiceImpl<PreHangingLineMapper, PreHangingLine> implements PreHangingLineService{

    @Resource
    private PreHangingLineMapper preHangingLineMapper;

    @Override
    public List<StationMateriel> queryPreHangingLineDetailPage(Map<String, Object> map) {
        return preHangingLineMapper.queryPreHangingLineDetailPage(map);
    }

    @Override
    public Long queryPreHangingLineDetailTotal(Map<String, Object> map) {
        return preHangingLineMapper.queryPreHangingLineDetailTotal(map);
    }

    @Override
    public List<ProductionStation> queryWorkstation(String type) {
        return preHangingLineMapper.queryWorkstation(type);
    }

    @Override
    public List<PreHangingLine> queryPreHangingLinePage(PreHangingLine preHangingLine) {
        String[] statusList = preHangingLine.getStatus().split(",");
        Map<String, Object> params = new HashMap<String, Object>(4);
        params.put("page",preHangingLine.getPage());
        params.put("limit",preHangingLine.getLimit());
        params.put("statusList",statusList);
        params.put("stationNumber",preHangingLine.getStationNumber());
        return preHangingLineMapper.queryPreHangingLinePage(params);
    }

    @Override
    public Long queryPreHangingLineTotal(PreHangingLine preHangingLine) {
        String[] statusList = preHangingLine.getStatus().split(",");
        Map<String, Object> params = new HashMap<String, Object>(4);
        params.put("statusList",statusList);
        params.put("stationNumber",preHangingLine.getStationNumber());
        return preHangingLineMapper.queryPreHangingLineTotal(params);
    }

    @Override
    public List<PreHangingLine> queryPreHangingLineStockPage(PreHangingLine preHangingLine) {
        return preHangingLineMapper.queryPreHangingLineStockPage(preHangingLine);
    }

    @Override
    public Long queryPreHangingLineStockTotal(PreHangingLine preHangingLine) {
        return preHangingLineMapper.queryPreHangingLineStockTotal(preHangingLine);
    }


}
